package com.zxr.system.service.impl;

import java.util.List;
import com.zxr.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zxr.system.mapper.OrderItemsMapper;
import com.zxr.system.domain.OrderItems;
import com.zxr.system.service.IOrderItemsService;
import com.zxr.common.core.text.Convert;

/**
 * 订单商品明细Service业务层处理
 * 
 * @author zxrproject
 * @date 2025-04-26
 */
@Service
public class OrderItemsServiceImpl implements IOrderItemsService 
{
    @Autowired
    private OrderItemsMapper orderItemsMapper;

    /**
     * 查询订单商品明细
     * 
     * @param orderItemId 订单商品明细主键
     * @return 订单商品明细
     */
    @Override
    public OrderItems selectOrderItemsByOrderItemId(Long orderItemId)
    {
        return orderItemsMapper.selectOrderItemsByOrderItemId(orderItemId);
    }

    /**
     * 查询订单商品明细列表
     * 
     * @param orderItems 订单商品明细
     * @return 订单商品明细
     */
    @Override
    public List<OrderItems> selectOrderItemsList(OrderItems orderItems)
    {
        return orderItemsMapper.selectOrderItemsList(orderItems);
    }

    /**
     * 新增订单商品明细
     * 
     * @param orderItems 订单商品明细
     * @return 结果
     */
    @Override
    public int insertOrderItems(OrderItems orderItems)
    {
        orderItems.setCreateTime(DateUtils.getNowDate());
        return orderItemsMapper.insertOrderItems(orderItems);
    }

    /**
     * 修改订单商品明细
     * 
     * @param orderItems 订单商品明细
     * @return 结果
     */
    @Override
    public int updateOrderItems(OrderItems orderItems)
    {
        orderItems.setUpdateTime(DateUtils.getNowDate());
        return orderItemsMapper.updateOrderItems(orderItems);
    }

    /**
     * 批量删除订单商品明细
     * 
     * @param orderItemIds 需要删除的订单商品明细主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemsByOrderItemIds(String orderItemIds)
    {
        return orderItemsMapper.deleteOrderItemsByOrderItemIds(Convert.toStrArray(orderItemIds));
    }

    /**
     * 删除订单商品明细信息
     * 
     * @param orderItemId 订单商品明细主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemsByOrderItemId(Long orderItemId)
    {
        return orderItemsMapper.deleteOrderItemsByOrderItemId(orderItemId);
    }
}
